Ext.define("util.commonUtil", {
	requires: ['Ext.ux.Notification'],
	getToolBarButton : function(toolJson, menuKey) {
		var result = {};
		Ext.Array.each(toolJson, function(name, index, countriesItSelf) {
		    if (name.menuId === menuKey) {
		    	result = toolJson[index].toolbarId[0];
		    	return false;
		    }
		});
		return result;
	},
	showToolTips:function(msg){
		Ext.create('widget.uxNotification', {
			title: '提示',
			position: 'br',
			autoCloseDelay: 2000,
			html: '<h4>操作结果:' + msg + '!</h4>'
		}).show();
	},
	doAjax:function(url,params){
		var me = this;
		Ext.Ajax.request({
			url:url,
			params:params,
			method:"POST",
			timeout:4000,
			success:function(response,opts){
				var respText = Ext.JSON.decode(response.responseText);
				//弹出右下角提示框
				me.showToolTips(respText.msg);
			},
			failure: function(resp,opts) {  
                 Ext.Msg.alert('错误', "错误信息为："+Ext.JSON.decode(response.responseText).msg);   
            }
		});
	}
	
});